#include "stdafx.h"
#include "OSException.h"

void RaiseOsError (const char* aMessage)
{
    DWORD Error = GetLastError ();
    if (Error != ERROR_SUCCESS) {
        char Buffer[2048] = {0};
        strcpy (Buffer, aMessage);
        strcat (Buffer, "\n");
        FormatMessageA (FORMAT_MESSAGE_FROM_SYSTEM, 0, Error, 1, Buffer + strlen (aMessage), 2048, 0);
        throw OSException (Buffer);
    }
}

